package Entities; import java.io.Serializable; import java.util.Observable; import java.util.Observer; public class Person implements Observer, Serializable { private static final long serialVersionUID = 1L; private String name; private String email; private String phone; /* * (non-Javadoc) * * @see java.lang.Object#hashCode() Used in order to determine the bucket * where to store the Entry<K,V> */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((phone == null) ? 0 : phone.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Person other = (Person) obj; if (email == null) { if (other.email != null) return false; } else if (!email.equals(other.email)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (phone == null) { if (other.phone != null) return false; } else if (!phone.equals(other.phone)) return false; return true; } public Person(String name, String email, String phone) { super(); this.name = name; this.email = email; this.phone = phone; } @Override public String toString() { return "Person [name=" + name + ", email=" + email + ", phone=" + phone + "]"; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public void update(Observable account, Object sum) { Account a = (Account) account; System.out.println(a + " : " + sum); } }